package com.ely.coupon.member.message;

import com.ely.coupon.common.core.constants.MessageConstants;

import com.ely.coupon.member.dto.SmsInfo;
import com.ely.coupon.member.message.callback.DefaultSendCallback;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class MessageService {
    @Resource
    RocketMQTemplate rocketMQTemplate;

    // 发送会员注册消息
    public void send(String memberId) {
        rocketMQTemplate.send(MessageConstants.Topic.TOPIC_MEMBER_REGISTER, MessageBuilder.withPayload(memberId).build());
    }

    // 发送短信
    public void sendVerifyCode(SmsInfo smsInfo) {
        rocketMQTemplate.send(MessageConstants.Topic.TOPIC_MEMBER_CODE, MessageBuilder.withPayload(smsInfo).build());
    }
}


